package cn.iocoder.mall.order.biz.service;

import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.utils.common.util.ObjectUtils;
import cn.iocoder.mall.order.api.OrderCredentialService;
import cn.iocoder.mall.order.api.dto.OrderCredentialDetailDTO;
import cn.iocoder.mall.order.biz.dao.OrderCredentialMapper;
import cn.iocoder.mall.order.biz.dataobject.OrderCredential;
import org.apache.dubbo.config.annotation.Service;

import javax.annotation.Resource;
import java.util.List;

/***
 *@author yinxucun
 *@date 2019-12-26 18:13 
 */
@org.springframework.stereotype.Service
@Service(validation = "true", version = "${dubbo.provider.OrderCredentialService.version}")
public class OrderCredentialServiceImpl implements OrderCredentialService {

    @Resource
    private OrderCredentialMapper orderCredentialMapper;


    @Override
    public CommonResult<List<OrderCredentialDetailDTO>> getOrderCredentialListBySellerIdAndDateRange(String userId, String startTim, String endTime){

        List<OrderCredential> list=orderCredentialMapper.getOrderCredentialListBuSellerId(userId,startTim,endTime);

        List<OrderCredentialDetailDTO> temp=ObjectUtils.copyList(list,OrderCredentialDetailDTO.class);

        if (list.isEmpty()){
            return CommonResult.error("");
        }
        return CommonResult.success(temp);

    }
}
